home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / jlib_0-6 / betajlib / funclist.txt < prev    next >
Encoding:
Text File  |  1995-04-02  |  32.3 KB  |  552 lines

  1.                  FUNCTION DESCRIPTIONS
  2.  
  3.       Copyright (C) 1995  Jonathan Paul Griffiths.  All rights reserved.
  4.  
  5. ===============================================================================
  6. This text file wil describe the library routines available for buffer functions,
  7. sprites,  the mouse,  and images.  Since I've decided to re-implement the
  8. screen functions as buffer functions,  I won't document the screen functions
  9. yet.  There is working code for most of them in the demo directory,  so consult
  10. that for the moment.
  11.                      Jon.
  12.  
  13.  p.s  This document is still under construction so be patient,  it might not
  14.      be here yet.
  15.  
  16. ===============================================================================
  17.  
  18.  
  19. ===============================================================================
  20. SPRITE FUNCTIONS
  21. ===============================================================================
  22.  
  23. OVERVIEW
  24.   Sprites are like little pictures with transparent backgrounds.  When you
  25.  draw them into a buffer or on to the screen, only the 'solid' part of them
  26.  is seen. This makes them perfect for things like baddies and bullets in games.
  27.  The JLib library provides routines to load and display sprites, as well as
  28.  animating and moving them automatically.
  29.  
  30.  The biggest sprite you can have is currently set to 64 by 64 pixels, but
  31.  you can change this if you want by changing the SPR_MAX_X and SPR_MAX_Y
  32.  #defines in jlib.h.
  33.  
  34.  There are 2 parts to a "sprite system" in JLib.  The first is the sprites
  35.  themselves,  the second is the frames for the sprites (the pictures).
  36.  Lets have a look at how the library defines a sprite system.
  37.  
  38.  the sprite_system structure :
  39.  
  40.  typedef struct{
  41.        USHORT no_sprites;             /* max number of sprites in system     */
  42.        UBYTE  *active_sprites;        /* array of flags for active sprites   */
  43.        sprite_record **sprites;       /* array of the sprites themselves     */
  44.        USHORT no_frames;              /* num of sprite data frames in system */
  45.        sprite_data_rec **sprite_data; /* array of frame data                 */
  46.  }sprite_system;
  47.  
  48.  The sprite system is created with 2 space considerations in mind.  The first
  49.  is how many sprites there will be on screen (or in a buffer) at one time.
  50.  Each sprite that you want needs a sprite_record structure to hold its data.
  51.  The number of allowable sprites is not limited although the more sprites you
  52.  add,  the slower the system will become. It is a good idea for both space
  53.  and speed efficiency to only create a sprite system with room for as many
  54.  sprites as you will actually use.
  55.  
  56.  The second consideration is how many frames (or pictures) you will be using.
  57.  Again It is more efficient to limit the frame numbers to the minimum you
  58.  need to hold all of your frames. Utilities are provided in the utes directory
  59.  that enable you to cut sprites from .PCX files and edit the sprite files
  60.  created.  This means you can design your sprites with almost any drawing
  61.  tool you want,  convert them to a .PCX and then cut them out for inclusion in
  62.  your game/demo/whatever.
  63.  
  64.  Lets have a look at the sprite_data_rec :
  65.  
  66.  typedef struct{
  67.        UBYTE width;     /* width of sprite */
  68.        UBYTE height;    /* width of sprite */
  69.        UBYTE *data;     /* x*y array of the data */
  70.        UBYTE *pattern;  /* RLE storage pattern */
  71.        UBYTE no_rects;  /* number of bounding rects */
  72.        UBYTE *rect_coords; /* coords of rects */
  73.  }sprite_data_rec;
  74.  
  75.  As you can see, it has a few extra pieces of information than just the sprites
  76.  picture.  For speed in handling the sprites I create a run length encoded
  77.  pattern and use this pattern to help process drawing/saving/restoring
  78.  operations quickly. The bounding rectangle information is for collision
  79.  detection,  which I have implemented but is not yet included in the library.
  80.  
  81.  Finally,  lets look at the sprite_record structure:
  82.  
  83.  typedef struct{
  84.        USHORT x;           /* current location */
  85.        USHORT y;
  86.  
  87.        UBYTE speed;        /* movement speed (0 = not moving ) */
  88.        UBYTE speed_counter;
  89.        BYTE xinc;          /* x and y increments when moving  */
  90.        BYTE yinc;
  91.  
  92.        UBYTE animspeed;    /* animation speed (0 = not animating ) */
  93.        UBYTE animspeed_counter;
  94.        UBYTE noframes;     /* no of animation frames */
  95.        USHORT frame_count;
  96.        USHORT frame;       /* current frame */
  97.        USHORT *animframes; /* array of frames in animation */
  98.  
  99.        UBYTE *buffer;      /* holds the info under the sprite */
  100.  }sprite_record;
  101.  
  102.  This whopper needs quite a bit of information! Each sprite has its own
  103.  movement and animation information which you can set.  This means you can
  104.  forget about having to manually animate sprites and let the system take over.
  105.  Movement is done the same way as you will see later. The sprite also keeps
  106.  track of its position and the information it is overwriting on a screen or
  107.  in a buffer.
  108.  
  109.  There is just a few more things you need to know about before you examine the
  110.  routines,  and that is the posistion information of a sprite.  because
  111.  sprites need to be able to move off the side of screens or buffers,  thier
  112.  coordinates need to be massaged to allow this to happen. for example,
  113.  a sprite at position 0,0 in a buffer would appear in the top left corner of
  114.  that buffer.  Because I use unsigned numbers to hold their posistion, how
  115.  can this sprite continue to move out of the buffer upwards or left?
  116.  
  117.  The answer is that I use some trickery.  Whenever you set a sprites posistion
  118.  in a buffer or on a screen, add the constants SPR_MAX_X and SPR_MAX_Y to its
  119.  x and y posistion first to get the posistion right. So,  while we can think
  120.  of a sprite at posistion 0,0 being in the top left of a buffer,  the library
  121.  thinks of that position as being SPR_MAX_X,SPR_MAX_Y . Now sprites can
  122.  continue to move up and left from this point. I hope this make sense to you
  123.  all,  look at demo6 to see it in action.
  124.  
  125.  The exception to this system of coordinate massaging  are the routines
  126.  buff/screen_stamp_spriteNC and buff/screen_stencil_spriteNC,  which draw a
  127.  frame to a screen/buff at the coordinates given.
  128.  
  129.  So how do you get some sprites up and running?
  130.  
  131.  First,  you initialise the sprite_system. Then you load some frames. Set
  132.  the x and y posistion, movement and animation information for a sprite, and
  133.  turn it on. Then call the appropriate save routine to capture the area where
  134.  the sprite will go. Now you can draw the sprite. Restore the sprite before
  135.  moving it anywhere.  Normally you update sprite animation and movement after
  136.  restoring the sprite and before saving the area underneath it. See demo 6
  137.  to catch this in action.
  138.  
  139.  Anyway,  on to the routine descriptions.  If you are left a little confused
  140.  by anything,  consult the source code. firstly,  to create a sprite system:
  141.  
  142. +----------------------------------------------------------------------------+
  143. |FUNCTION:sprite_system *sprite_init(USHORT max_sprites,USHORT max_frames)   |
  144. |PURPOSE: intitialises a sprite system.                                      |
  145. |PARAMETERS: The no of sprites and frames to reserve space for.              |
  146. |RETURNS: A handle to the allocated buffer or NULL if allocation failed.     |
  147. +----------------------------------------------------------------------------+
  148. |DESCRIPTION:                                                                |
  149. |  This function allocates memory for the system records, initialises  the   |
  150. | sprites,  leaving then all turned off and returning the handle.            |
  151. +----------------------------------------------------------------------------+
  152.  
  153.  Then to load in the frames:
  154.  
  155. +----------------------------------------------------------------------------+
  156. |FUNCTION: sprite_load(char *filename,sprite_system *ssys)                   |
  157. |PURPOSE: load in sprite frames from a file into a sprite system.            |
  158. |PARAMETERS: The filename and the sprite system                              |
  159. |RETURNS: A value as define in jlib.h                                        |
  160. +----------------------------------------------------------------------------+
  161. |DESCRIPTION:                                                                |
  162. |  This function loads in the sprite frames from the given file if possible, |
  163. | create the RLE pattern for each and stores them in the sprite system.      |
  164. | The format of a sprite file is easy to figure out if I don't include it in |
  165. | this release. (see the ute programs for examples                           |
  166. +----------------------------------------------------------------------------+
  167.  
  168.  To find the next unused sprite :
  169.  
  170. +----------------------------------------------------------------------------+
  171. |FUNCTION: USHORT sprite_find_first_free(sprite_system *spr_sys)             |
  172. |PURPOSE: return the number of the next free sprite.                         |
  173. |PARAMETERS: The sprite system.                                              |
  174. |RETURNS: the number of the first free sprite.                               |
  175. +----------------------------------------------------------------------------+
  176. |DESCRIPTION:                                                                |
  177. |  This function will die if there is not a free sprite left. You have been  |
  178. | warned!                                                                    |
  179. +----------------------------------------------------------------------------+
  180.  
  181. then:
  182.  
  183. +----------------------------------------------------------------------------+
  184. |FUNCTION: void sprite_turn_on(sprite_system *spr_sys,USHORT snum)           |
  185. |PURPOSE: turn on the given sprite so it will be drawn when drawing called.  |
  186. |PARAMETERS: The sprite system and the number of the sprite.                 |
  187. |RETURNS: nothing.                                                           |
  188. +----------------------------------------------------------------------------+
  189. |DESCRIPTION:                                                                |
  190. |  This function only sets the appropriate flag for the sprite, it does not  |
  191. | actually draw it to a screen or buffer.                                    |
  192. +----------------------------------------------------------------------------+
  193.  
  194.  Not forgetting at some stage you might want to :
  195.  
  196. +----------------------------------------------------------------------------+
  197. |FUNCTION: void sprite_turn_off(sprite_system *spr_sys,USHORT snum)          |
  198. |PURPOSE: turn off the given sprite so it won't be drawn when drawing called.|
  199. |PARAMETERS: The sprite system and the number of the sprite.                 |
  200. |RETURNS: nothing.                                                           |
  201. +----------------------------------------------------------------------------+
  202. |DESCRIPTION:                                                                |
  203. |  This function only clears the appropriate flag for the sprite, it does not|
  204. | actually erase it from a screen or buffer.                                 |
  205. +----------------------------------------------------------------------------+
  206.  
  207.  Also useful :
  208.  
  209. +----------------------------------------------------------------------------+
  210. |FUNCTION:void sprite_set_an_frame(sprite_system *ssys,USHORT snum,USHORT frame) |
  211. |PURPOSE: set the frame of a given sprite.                                   |
  212. |PARAMETERS: The sprite system,the number of the sprite and the frame number.|
  213. |RETURNS: nothing.                                                           |
  214. +----------------------------------------------------------------------------+
  215. |DESCRIPTION:                                                                |
  216. |  This function only sets the frame, it does not redraw the sprite with the |
  217. |  new frame. Don't change the frame unless the sprite has been restored.    |
  218. +----------------------------------------------------------------------------+
  219.  
  220.  And :
  221.  
  222. +----------------------------------------------------------------------------+
  223. |FUNCTION:void sprite_set_xy(sprite_system *spr_sys,USHORT snum,USHORT newx,USHORT newy)
  224. |PURPOSE: set the x and y position of a given sprite.                        |
  225. |PARAMETERS: The sprite system,the number of the sprite, x and y.            |
  226. |RETURNS: nothing.                                                           |
  227. +----------------------------------------------------------------------------+
  228. |DESCRIPTION:                                                                |
  229. |  This function only sets the position, not redraw the sprite with this new |
  230. | position. Don't change the position unless the sprite has been restored.   |
  231. +----------------------------------------------------------------------------+
  232.  
  233.  To have the system take care of it all for you :
  234.  
  235. +----------------------------------------------------------------------------+
  236. |FUNCTION:void sprite_set_move_info(sprite_system *spr_sys,USHORT snum,      |
  237. |                          UBYTE speed,BYTE xinc,BYTE yinc)                  |
  238. |PURPOSE: set up the movement info of a given sprite.                        |
  239. |PARAMETERS: The sprite system,sprite number ,speed, x and y increments.     |
  240. |RETURNS: nothing.                                                           |
  241. +----------------------------------------------------------------------------+
  242. |DESCRIPTION:                                                                |
  243. |  xinc and yinc will be added to the sprites position every 'speed' times   |
  244. | that sprite_update_anim_and_move() is called for this sprite. A speed of   |
  245. | zero means the sprite will not move at all. For example,  to make a sprite |
  246. | move left 2 pixels every third update you would use:                       |
  247. |                                                                            |
  248. | sprite_set_move_info(a_system,a_sprite,3,-2,0);                            |
  249. +----------------------------------------------------------------------------+
  250.  
  251.  Along with this:
  252.  
  253. +----------------------------------------------------------------------------+
  254. |FUNCTION: void sprite_set_anim_info(sprite_system *spr_sys,USHORT snum,     |
  255. |                            UBYTE anspeed,UBYTE noframes,USHORT *animpat)   |
  256. |PURPOSE: set up the animation info of a given sprite.                       |
  257. |PARAMETERS: The sprite system,sprite num,speed,num frames and pattern       |
  258. |RETURNS: nothing.                                                           |
  259. +----------------------------------------------------------------------------+
  260. |DESCRIPTION:                                                                |
  261. | Every 'anspeed' times that sprite_update_anim_and_move() is called for this|
  262. | sprite,  the sprite will move to the next frame in animpat, which is an    |
  263. | array of 'noframes' sprite frame numbers. If the end of the list is reached|
  264. | then animating will begin again from the beginning. anspeed is handled as  |
  265. | for speed in sprite_set_move_info(). For example,  to make a sprite swap   |
  266. | between 2 frames every every fifth update you could use:                   |
  267. |                                                                            |
  268. | #define NUM_FRAMES 2;                                                      |
  269. | USHORT animation_pattern[NUM_FRAMES] = {0,1};                              |
  270. |                                                                            |
  271. | sprite_set_anim_info(a_system,a_sprite,5,NUM_FRAMES,animation_pattern);    |
  272. +----------------------------------------------------------------------------+
  273.  
  274.   This:
  275.  
  276. +-----------------------------------------------------------------------------+
  277. |FUNCTION:void sprite_update_anim_and_move(sprite_system *spr_sys,USHORT snum)|
  278. |PURPOSE: update the movement and animation of a sprite.                      |
  279. |PARAMETERS: The sprite system, and the number of the sprite.                 |
  280. |RETURNS: nothing.                                                            |
  281. +-----------------------------------------------------------------------------+
  282. |DESCRIPTION:                                                                 |
  283. |  This function only updates the position and frame of the sprite. It doesn't|
  284. |  redraw the sprite with these new details.This routine should be called when|
  285. |  the sprite has been restored, not while it is still drawn somewhere.       |
  286. +-----------------------------------------------------------------------------+
  287.  
  288.  And This:
  289.  
  290. +-----------------------------------------------------------------------------+
  291. |FUNCTION:void sprite_update_all_anim_and_move(sprite_system *spr_sys)        |
  292. |PURPOSE: update the movement and animation of all active sprite.             |
  293. |PARAMETERS: The sprite system.                                               |
  294. |RETURNS: nothing.                                                            |
  295. +-----------------------------------------------------------------------------+
  296. |DESCRIPTION:                                                                 |
  297. |  This function only updates the position and frame of sprites that are      |
  298. |  turned on. See the routine above for other warnings.                       |
  299. +-----------------------------------------------------------------------------+
  300.  
  301. to check if two sprites are colliding you can use:
  302.  
  303. +-----------------------------------------------------------------------------+
  304. |FUNCTION:int sprite_do_intersect(sprite_system *spr_sys,USHORT s1,USHORT s2);|
  305. |PURPOSE: see if 2 sprites are colliding using their bounding rectangles.     |
  306. |PARAMETERS: The sprite system.                                               |
  307. |RETURNS: 1 if the sprites are colliding, otherwise nothing.                  |
  308. +-----------------------------------------------------------------------------+
  309. |DESCRIPTION:                                                                 |
  310. |  This function will only detect collisions between sprites that are turned  |
  311. |  on.                                                                        |
  312. +-----------------------------------------------------------------------------+
  313.  
  314.  
  315.  
  316. ===============================================================================
  317. BUFFER FUNCTIONS
  318. ===============================================================================
  319.  
  320. OVERVIEW
  321.   Buffers are portions of system memory set aside to act as screens.  They
  322.  can be any width or height, and are only limited in size by available
  323.  memory.  Buffer memory is organised the same way as memory in mode 13h,
  324.  that is,  it is a contigous block of (width * height) unsigned chars. Thus
  325.  a point in a buffer at a posistion X,Y is addressed by the formula:
  326.  
  327.    point memory location = buffer[ (Y*buffer width) + X]
  328.  
  329.  This formula is provided only to help you visualise what a buffer is,
  330.  you should never access a record in the library directly,  only through
  331.  the functions and macros provided.  This is because if I need to change
  332.  a records field names (etc) then direct access code will begin to fail.
  333.  Need an example? consider this:
  334.  
  335.  the buffer_rec type used by the library is declared thus:
  336.  
  337.  typedef struct{
  338.       USHORT width;   /* width of buffer */
  339.       USHORT height;  /* height of buffer */
  340.       UBYTE *buffer;  /* the buffer */
  341.  }buffer_rec;
  342.  
  343.  If you wanted to know the width of a buffer,  you could write something
  344.  of the form:
  345.  
  346.  buffer_rec *buff;
  347.  
  348.  ...
  349.  
  350.  width = buff->width;   /* BAD CODE */
  351.  
  352.  This is bad form because if I decided to change the name of the 'width' field
  353.  to 'buffer_width' your code would die.  Generally I have provided macros to
  354.  access the feilds of structures in the library. In this case,  the correct
  355.  way to get the width would be:
  356.  
  357.  width = B_X_SIZE(buff);
  358.  
  359.  This applies to all of the library structures. look in "jlib.h" to see the
  360.  macros.
  361.  
  362.  Buffers are created using the buff_init() function. A buff_destroy() function
  363.  is on its way (but not currently a priority).
  364.  
  365. +----------------------------------------------------------------------------+
  366. |FUNCTION: buffer_rec *buff_init(USHORT width,USHORT height)                 |
  367. |PURPOSE: Initialise an offscreen buffer                                     |
  368. |PARAMETERS: The width and height of the buffer to be created.               |
  369. |RETURNS: A handle to the allocated buffer or NULL if allocation failed.     |
  370. +----------------------------------------------------------------------------+
  371. |DESCRIPTION:                                                                |
  372. |  This function allocates memory for the buffer record,the buffer itself,   |
  373. | fills the buffer with zeros and returns the handle.                        |
  374. +----------------------------------------------------------------------------+
  375.  
  376.  
  377.  Once the buffer is created,  other fuctions may be used to draw into it.  Only
  378.  the draw point routines are available presently,  but the others will be ported
  379.  shortly. sprite functions are available now,  however.
  380.  
  381. +----------------------------------------------------------------------------+
  382. |FUNCTION: void buff_draw_point(buffer_rec *buff,USHORT x, USHORT y, UBYTE c)|
  383. |PURPOSE: plot a dot at (x, y) with color c with clipping in a buffer.       |
  384. |PARAMETERS: The buffer to draw to, X & Y pos and the color of the point.    |
  385. |RETURNS: nothing.                                                           |
  386. +----------------------------------------------------------------------------+
  387. |DESCRIPTION:                                                                |
  388. |  If the X or Y pos > the width or height of the buffer respectively then   |
  389. | the point will not be drawn.                                               |
  390. +----------------------------------------------------------------------------+
  391.  
  392. +----------------------------------------------------------------------------+
  393. |FUNCTION:void buff_draw_pointNC(buffer_rec *buff,USHORT x,USHORT y,UBYTE c) |
  394. |PURPOSE: plot a dot at (x, y) with color c without clipping in a buffer.    |
  395. |PARAMETERS: The buffer to draw to, X & Y pos and the color of the point.    |
  396. |RETURNS: nothing.                                                           |
  397. +----------------------------------------------------------------------------+
  398. |DESCRIPTION:                                                                |
  399. |  If the X or Y pos > the width or height of the buffer respectively then   |
  400. | the program may well crash. The point may instead wrap around the buffer.  |
  401. | Use with care. Slightly faster than the clipping function.                 |
  402. +----------------------------------------------------------------------------+
  403.  
  404.  
  405.  Portions of the screen can also be captured into buffers.
  406.  
  407. +----------------------------------------------------------------------------+
  408. |FUNCTION: __inline void buff_blit_screen_toNC( USHORT bfx, USHORT bfy,      |
  409. |              buffer_rec *buff,USHORT x1, USHORT y1,USHORT x2, USHORT y2)   |
  410. |PURPOSE: blit a portion of the screen without clipping to bfx,bfy.          |
  411. |PARAMETERS: The X & Y posistion to blit to in the buffer,  The buffer handle|
  412. |           ,two opposite corners of a rectangle in the screen.              |
  413. |RETURNS: nothing                                                            |
  414. +----------------------------------------------------------------------------+
  415. |DESCRIPTION:                                                                |
  416. |  This function performs no checking. If your coordinates are not valid your|
  417. | program will most likely crash. Use with caution.                          |
  418. +----------------------------------------------------------------------------+
  419.  
  420.  And portions of the buffer can be displayed on screen.
  421.  
  422. +----------------------------------------------------------------------------+
  423. |FUNCTION: __inline void screen_blit_buffer_to( USHORT scx, USHORT scy,      |
  424. |               buffer_rec *buff,USHORT x1, USHORT y1,USHORT x2, USHORT y2)  |
  425. |PURPOSE: blit a portion of the buffer given to the screen with clipping     |
  426. |PARAMETERS: The X & Y posistion to blit to on the screen,  The buffer handle|
  427. |           ,two opposite corners of a rectangle in the buffer.              |
  428. |RETURNS: nothing                                                            |
  429. +----------------------------------------------------------------------------+
  430. |DESCRIPTION:                                                                |
  431. |  This function will clip the blitting rectangle to the screen and buffer.  |
  432. +----------------------------------------------------------------------------+
  433.  
  434. +----------------------------------------------------------------------------+
  435. |FUNCTION: __inline void screen_blit_buffer_toNC( USHORT scx, USHORT scy,    |
  436. |               buffer_rec *buff,USHORT x1, USHORT y1,USHORT x2, USHORT y2)  |
  437. |PURPOSE: blit a portion of the buffer given to the screen without clipping  |
  438. |PARAMETERS: The X & Y posistion to blit to on the screen,  The buffer handle|
  439. |           ,two opposite corners of a rectangle in the buffer.              |
  440. |RETURNS: nothing                                                            |
  441. +----------------------------------------------------------------------------+
  442. |DESCRIPTION:                                                                |
  443. |  This function does no checking - use with caution as it may cause crashes |
  444. | if given non valid coordinates. Faster than its clipping counterpart.      |
  445. +----------------------------------------------------------------------------+
  446.  
  447. +----------------------------------------------------------------------------+
  448. |FUNCTION:void screen_blit_fs_buffer(buffer_rec *buff,USHORT x, USHORT y)    |
  449. |PURPOSE: blit a buffer of width 320 to the screen.                          |
  450. |PARAMETERS: The X & Y posistion to blit from in the buffer.                 |
  451. |RETURNS: nothing                                                            |
  452. +----------------------------------------------------------------------------+
  453. |DESCRIPTION:                                                                |
  454. |  This function does no checking - use with caution as it may cause crashes |
  455. | if given non valid coordinates. Faster than its clipping counterpart.      |
  456. +----------------------------------------------------------------------------+
  457.  
  458.  
  459.  Sprite routines can be used on buffers also. Note that in all cases,  the
  460.  clipping function is detailed while the non clipping version isn't.  Take
  461.  it as read that the non clipping versions are faster but corespondingly
  462.  more dangerous with invalid input.
  463.  
  464.  
  465. +----------------------------------------------------------------------------+
  466. |FUNCTION:void buff_draw_sprite(sprite_system *spr_sys, USHORT snum,         |
  467. |                               buffer_rec *obuff);                          |
  468. |PURPOSE: draw a sprite on screen with clipping                              |
  469. |PARAMETERS:The sprite system handle, the sprite number and the target buffer|
  470. |RETURNS: nothing                                                            |
  471. +----------------------------------------------------------------------------+
  472. |DESCRIPTION:                                                                |
  473. |  This function draws the given sprite into the given buffer if it is on.   |
  474. +----------------------------------------------------------------------------+
  475.  
  476.  
  477. +----------------------------------------------------------------------------+
  478. |FUNCTION:void buff_save_sprite(sprite_system *spr_sys, USHORT snum,         |
  479. |                               buffer_rec *obuff);                          |
  480. |PURPOSE: save the area that a sprite will occupy into the sprites buffer    |
  481. |PARAMETERS:The sprite system handle, the sprite number and the target buffer|
  482. |RETURNS: nothing                                                            |
  483. +----------------------------------------------------------------------------+
  484. |DESCRIPTION:                                                                |
  485. |  This function saves the given sprite area from a buffer irrespective of   |
  486. | whether it is on.                                                          |
  487. +----------------------------------------------------------------------------+
  488.  
  489.  
  490. +----------------------------------------------------------------------------+
  491. |FUNCTION:void buff_rest_sprite(sprite_system *spr_sys, USHORT snum,         |
  492. |                               buffer_rec *obuff);                          |
  493. |PURPOSE: restore the background area that a sprite occupied in the buffer   |
  494. |PARAMETERS:The sprite system handle, the sprite number and the target buffer|
  495. |RETURNS: nothing                                                            |
  496. +----------------------------------------------------------------------------+
  497. |DESCRIPTION:                                                                |
  498. |  This function restores the given sprite area from the sprites buffer      |
  499. | irrespective of whether it is turned on.                                   |
  500. +----------------------------------------------------------------------------+
  501.  
  502.  
  503. +----------------------------------------------------------------------------+
  504. |FUNCTION: void buff_stamp_spriteNC(USHORT x,USHORT y,sprite_system *spr_sys,|
  505. |                                    USHORT frame,buffer_rec *obuff);        |
  506. |PURPOSE: Stamp a sprite frame on a buffer without clipping                  |
  507. |PARAMETERS:The x and y position,sprite system handle, frame number and the  |
  508. |            target buffer.                                                  |
  509. |RETURNS: nothing                                                            |
  510. +----------------------------------------------------------------------------+
  511. |DESCRIPTION:                                                                |
  512. | "stamp" means that the sprites background is drawn as zeros into the buffer|
  513. | . This routine does not alter the X and Y positions given,  so sprite      |
  514. | frames can't be drawn partially on the side of buffers.  The main use for  |
  515. | this routine is intended to be drawing game levels that are made from      |
  516. | blocks stored as sprite frames.                                            |
  517. +----------------------------------------------------------------------------+
  518.  
  519.  
  520. +----------------------------------------------------------------------------+
  521. |FUNCTION:void buff_stencil_spriteNC(USHORT x,USHORT y,sprite_system *spr_sys|
  522. |                                    ,USHORT frame,buffer_rec *obuff);       |
  523. |PURPOSE: Stencil a sprite frame on a buffer without clipping                |
  524. |PARAMETERS:The x and y position,sprite system handle, frame number and the  |
  525. |            target buffer.                                                  |
  526. |RETURNS: nothing                                                            |
  527. +----------------------------------------------------------------------------+
  528. |DESCRIPTION:                                                                |
  529. |  "Stencil" means that the sprites background is not drawn into the buffer. |
  530. | This routine does not alter the X and Y positions given,  so sprite        |
  531. | frames can't be drawn partially on the side of buffers.  The main use for  |
  532. | this routine is intended to be drawing features that are drawn over the top|
  533. | of screens, such as font letters stored as sprite frames.                  |
  534. +----------------------------------------------------------------------------+
  535.  
  536.  A couple of functions let you update all of the sprites in your system. They
  537.  act by calling the (save,rest,draw) function once for each sprite in the
  538.  system.
  539.  
  540. +-----------------------------------------------------------------------------+
  541. |FUNCTION:void buff_save_all_sprites(sprite_system *spr_sys,buffer_rec *obuff)|       |
  542. |FUNCTION:void buff_rest_all_sprites(sprite_system *spr_sys,buffer_rec *obuff)|       |
  543. |FUNCTION:void buff_draw_all_sprites(sprite_system *spr_sys,buffer_rec *obuff)|       |
  544. |PURPOSE: Save/restore/draw all sprites to the given buffer using clipping    |
  545. |        routines.                                                            |
  546. |PARAMETERS:The sprite system handle and the target buffer.                   |
  547. |RETURNS: nothing                                                            |
  548. +----------------------------------------------------------------------------+
  549. |DESCRIPTION:                                                                |
  550. |  Essentally just a for loop.                                               |
  551. +----------------------------------------------------------------------------+
  552.